//
//  LYMineHeaderItem.m
//  artist
//
//  Created by Jay_Apple on 16/5/4.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYMineHeaderItem.h"
#import "LYMineHeaderItemModel.h"

@implementation LYMineHeaderItem

- (instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        [self setUp];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder{

    if (self = [super initWithCoder:aDecoder]) {
        [self setUp];
    }
    
    return self;

}

- (void)setUp{

    self.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 5);
    self.titleLabel.font = [UIFont systemFontOfSize:12];
    [self setTitleColor:[UIColor colorWithHexString:@"#535353" alpha:1.0] forState:UIControlStateNormal];

}

- (void)setModel:(LYMineHeaderItemModel *)model{
    
    _model = model;
    
    [self setImage:[UIImage imageNamed:_model.image] forState:UIControlStateNormal];
    [self setTitle:_model.title forState:UIControlStateNormal];

}

+ (instancetype)itemWithModel:(LYMineHeaderItemModel *)model{

    LYMineHeaderItem *item = [LYMineHeaderItem buttonWithType:UIButtonTypeCustom];
    item.model = model;
    return item;
    

}


@end
